/*#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

const int MaxN = 1e6+5;

bool isp[MaxN];
int p[78500];
int cnt;

int main(){

	isp[1] = true;
	for(int i = 2; i < MaxN; ++i){
		if(!isp[i]){
			p[++cnt] = i;
		}
		for(int j = 1; j <= cnt && i * p[j] < MaxN; ++j){
			isp[i * p[j]] = true;
			if(i % p[j] == 0) break;
		}
	}
	
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	int t;
	cin >> t;
	while(t--){
		int n;
		cin >> n;
		int l = 1,r = 78500;
		while(l <= r){
			int mid = l + (r - l)/2;
			if(p[mid] > n){
				r = mid - 1;
			}else{
				l = mid + 1;
			}
		}
		vector<int> ret(n/2);
		int cnt = 0;
		for(int i = 1; i <= r; ++i){
			ret[cnt] = p[i];
			++cnt;
		}
		int sub = n/2 - r;
		while(sub){
			for(int i = 2; i <= sqrt(n); ++i){
				if(n % i == 0){
					int x = n / i;
					if(isp[i] || isp[x]){
						ret[cnt] = n;
						++cnt;
						--sub;
						break;
					}
				}
			}
			--n;
		}
		sort(ret.begin(),ret.end());
		for(int i = 0; i < ret.size(); ++i){
			cout << ret[i] << ' ';
		}
		if(t) cout << endl;
	}
	return 0;
}
*/
#include <bits/stdc++.h>
using namespace std;
int vis[1000010];

int main()
{
    int _;
    cin>>_;
    while(_--)
    {
        int n;
        cin>>n;
        vector<int>a;
        for(int i=2;i<=n;i++)
        {
            if(!vis[i])
            {
                a.push_back(i);
                for(auto x:a)
                {
                    if(x*i>n)break;
                    vis[i*x]=1;
                }
            }
        }
        n>>=1;
        for(int i=0;i<n;i++)cout<<a[i]<<' ';
        cout<<endl;
        
    }
    return 0;
}
